#include "CollectBase.h"
#include "ColorfulLog.h"
#include <iostream>


/***************************************************
 * mode name:CollectBase
 * brief:数据采集抽象类，用于当作采集线程的基类
 * @author yxt
 * @created 2024/06/03 11:08:11
 * @imfor ~/bigSystem/closedLoop_regulation/src/CollectBase/CollectBase.cpp
 * @modify:
 * 		
***************************************************/
CollectBase::CollectBase(QObject *parent) : QThread(parent)
{
    collectingFlag = false;
}

CollectBase::~CollectBase()
{

}

void CollectBase::run(){
    LOG_ERR("The run method has not been rewritten!\n");

}

void CollectBase::collectingEEG(bool state){
    collectingFlag = state;
}
void CollectBase::changeConnectingState(bool state){
    connectingFlag = state;
}
bool CollectBase::is_collecting(){
    return collectingFlag;
}
bool CollectBase::is_connecting(){
    return connectingFlag;
}

void CollectBase::stopCollecting(){
    collectingFlag = false;
    // connectingFlag = false;
    this->quit();  //这个会等到数据处理完，才退出
    this->wait();  //等待结束（会出现阻塞，但是感觉不到），回收资源
}